package com.jz.netthings.application.providerCollection.controller;


import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.jz.netthings.application.providerCollection.bean.Inflating;
import com.jz.netthings.application.providerCollection.bean.InputResource;
import com.jz.netthings.application.providerCollection.bean.ProvisionConsumable;
import com.jz.netthings.application.providerCollection.service.InputResourceService;
import com.jz.netthings.application.providerCollection.service.ProvisionConsumableService;
import com.jz.netthings.exception.AdscmSystemException;
import com.jz.netthings.support.SimpleCoreResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.List;

/**
 * <p>
 * 采浆记录-输入资源 前端控制器
 * </p>
 *
 * @author zyl
 * @since 2019-03-22
 */
@RestController
@RequestMapping("/adscm/application/providerCollection/select/inputResource")
public class InputResourceController {

    @Autowired
    InputResourceService inputResourceService;
    @RequestMapping("/selectInputResource")
    public SimpleCoreResponse selectInputResource( String mlogId , HttpServletRequest request) throws AdscmSystemException, IOException {
        Wrapper<InputResource> wrapper =new EntityWrapper<>();
        wrapper.like("mlogId", mlogId);
        List<InputResource> inputResources = inputResourceService.selectList(wrapper);
        InputResource inputResource =new InputResource();
        if (inputResources!=null && inputResources.size()>0){
            inputResource=inputResources.get(0);
        }
        return new SimpleCoreResponse("200","查询成功" ,inputResource);
    }
}

